package com.lixw.springai.config;

import com.lixw.springai.service.WeatherService;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: McpServerConfig
 * @Description:
 * @Author: xuweiLi
 * @Create: 2025/8/26 19:01
 **/
@Configuration
public class McpServerConfig {

    /**
     * 将工具方法暴露给外部的Mcp Client
     * @return 工具提供者
     */
    @Bean
    public ToolCallbackProvider toolCallbackProvider(WeatherService weatherService) {
        return MethodToolCallbackProvider.builder().toolObjects(weatherService).build();
    }
}